package com.own.business.system.user.entity.dto;

import com.own.business.system.user.entity.bo.SystemTripartiteAccountBo;
import com.own.component.common.base.entity.BaseDto;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * SystemTripartiteAccountDto
 *
 * @author chenxueli
 * @date 2021/10/07 16:30:18
 */
@Schema(title = "系统三方账号表" + ConstantBeanSuffix.DTO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemTripartiteAccountDto extends BaseDto<SystemTripartiteAccountBo> {

    @Schema(title = "角色id")
    private Long targetId;

    @Schema(title = "用户id")
    private Long userId;

    @Schema(title = "账号类型")
    private String type;

    /**
     * 转业务层对象
     *
     * @param entity 原业务层对象
     * @return 业务层对象
     */
    @Override
    public SystemTripartiteAccountBo toBo(SystemTripartiteAccountBo entity) {
        if (entity == null) {
            entity = new SystemTripartiteAccountBo();
        }
        entity.setTargetId(targetId);
        entity.setUserId(userId);
        entity.setType(type);
        return super.toBo(entity);
    }

}
